// http protocol, uses for Http protocol functions.
//
#pragma once
#include "HttpBuffer.h"
#include "HttpConnect.h"

namespace HttpProtocol
{

class CHttpSession
{
public:
	CHttpSession(LPCSTR pstrAgent = NULL,
		DWORD_PTR dwContext = 1,
		DWORD dwAccessType = INTERNET_OPEN_TYPE_DIRECT,
		LPCSTR pstrProxyName = NULL,
		LPCSTR pstrProxyBypass = NULL,
		DWORD dwFlags = 0);
	~CHttpSession(void);

public:
	CHttpConnect* GetHttpConnection(LPCSTR pstrServer, DWORD dwFlags,
		INTERNET_PORT nPort = INTERNET_INVALID_PORT_NUMBER,
		LPCSTR pstrUserName = NULL, LPCSTR pstrPassword = NULL);

	operator HINTERNET() const;

	BOOL Release(void);

private:
	HINTERNET m_hSession;
};

}